\(\int (3+b \sin (e+f x))^2 \, dx\) [681]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 12, antiderivative size = 45 \[ \int (3+b \sin (e+f x))^2 \, dx=\frac {1}{2} \left (18+b^2\right ) x-\frac {6 b \cos (e+f x)}{f}-\frac {b^2 \cos (e+f x) \sin (e+f x)}{2 f} \]

[Out]

1/2*(2*a^2+b^2)*x-2*a*b*cos(f*x+e)/f-1/2*b^2*cos(f*x+e)*sin(f*x+e)/f

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.11, number of steps used = 1, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.083, Rules used = {2723} \[ \int (3+b \sin (e+f x))^2 \, dx=\frac {1}{2} x \left (2 a^2+b^2\right )-\frac {2 a b \cos (e+f x)}{f}-\frac {b^2 \sin (e+f x) \cos (e+f x)}{2 f} \]

[In]

Int[(a + b*Sin[e + f*x])^2,x]

[Out]

((2*a^2 + b^2)*x)/2 - (2*a*b*Cos[e + f*x])/f - (b^2*Cos[e + f*x]*Sin[e + f*x])/(2*f)

Rule 2723

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(2*a^2 + b^2)*(x/2), x] + (-Simp[2*a*b*(Cos[c
+ d*x]/d), x] - Simp[b^2*Cos[c + d*x]*(Sin[c + d*x]/(2*d)), x]) /; FreeQ[{a, b, c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \frac {1}{2} \left (2 a^2+b^2\right ) x-\frac {2 a b \cos (e+f x)}{f}-\frac {b^2 \cos (e+f x) \sin (e+f x)}{2 f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.12 (sec) , antiderivative size = 41, normalized size of antiderivative = 0.91 \[ \int (3+b \sin (e+f x))^2 \, dx=-\frac {-2 \left (18+b^2\right ) (e+f x)+24 b \cos (e+f x)+b^2 \sin (2 (e+f x))}{4 f} \]

[In]

Integrate[(3 + b*Sin[e + f*x])^2,x]

[Out]

-1/4*(-2*(18 + b^2)*(e + f*x) + 24*b*Cos[e + f*x] + b^2*Sin[2*(e + f*x)])/f

Maple [A] (verified)

Time = 0.87 (sec) , antiderivative size = 43, normalized size of antiderivative = 0.96

method result size
risch \(a^{2} x +\frac {b^{2} x}{2}-\frac {2 a b \cos \left (f x +e \right )}{f}-\frac {b^{2} \sin \left (2 f x +2 e \right )}{4 f}\) \(43\)
parallelrisch \(\frac {4 a^{2} f x +2 b^{2} f x -8 \cos \left (f x +e \right ) a b -\sin \left (2 f x +2 e \right ) b^{2}+8 a b}{4 f}\) \(49\)
parts \(a^{2} x +\frac {b^{2} \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f}-\frac {2 a b \cos \left (f x +e \right )}{f}\) \(49\)
derivativedivides \(\frac {b^{2} \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-2 \cos \left (f x +e \right ) a b +\left (f x +e \right ) a^{2}}{f}\) \(51\)
default \(\frac {b^{2} \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-2 \cos \left (f x +e \right ) a b +\left (f x +e \right ) a^{2}}{f}\) \(51\)
norman \(\frac {\left (a^{2}+\frac {b^{2}}{2}\right ) x +\frac {b^{2} \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}+\left (a^{2}+\frac {b^{2}}{2}\right ) x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (2 a^{2}+b^{2}\right ) x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\frac {4 a b \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {b^{2} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f}+\frac {4 a b \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}}{\left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{2}}\) \(144\)

[In]

int((a+b*sin(f*x+e))^2,x,method=_RETURNVERBOSE)

[Out]

a^2*x+1/2*b^2*x-2*a*b*cos(f*x+e)/f-1/4*b^2/f*sin(2*f*x+2*e)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 45, normalized size of antiderivative = 1.00 \[ \int (3+b \sin (e+f x))^2 \, dx=-\frac {b^{2} \cos \left (f x + e\right ) \sin \left (f x + e\right ) - {\left (2 \, a^{2} + b^{2}\right )} f x + 4 \, a b \cos \left (f x + e\right )}{2 \, f} \]

[In]

integrate((a+b*sin(f*x+e))^2,x, algorithm="fricas")

[Out]

-1/2*(b^2*cos(f*x + e)*sin(f*x + e) - (2*a^2 + b^2)*f*x + 4*a*b*cos(f*x + e))/f

Sympy [A] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.73 \[ \int (3+b \sin (e+f x))^2 \, dx=\begin {cases} a^{2} x - \frac {2 a b \cos {\left (e + f x \right )}}{f} + \frac {b^{2} x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {b^{2} x \cos ^{2}{\left (e + f x \right )}}{2} - \frac {b^{2} \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} & \text {for}\: f \neq 0 \\x \left (a + b \sin {\left (e \right )}\right )^{2} & \text {otherwise} \end {cases} \]

[In]

integrate((a+b*sin(f*x+e))**2,x)

[Out]

Piecewise((a**2*x - 2*a*b*cos(e + f*x)/f + b**2*x*sin(e + f*x)**2/2 + b**2*x*cos(e + f*x)**2/2 - b**2*sin(e +
f*x)*cos(e + f*x)/(2*f), Ne(f, 0)), (x*(a + b*sin(e))**2, True))

Maxima [A] (verification not implemented)

none

Time = 0.18 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.02 \[ \int (3+b \sin (e+f x))^2 \, dx=a^{2} x + \frac {{\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} b^{2}}{4 \, f} - \frac {2 \, a b \cos \left (f x + e\right )}{f} \]

[In]

integrate((a+b*sin(f*x+e))^2,x, algorithm="maxima")

[Out]

a^2*x + 1/4*(2*f*x + 2*e - sin(2*f*x + 2*e))*b^2/f - 2*a*b*cos(f*x + e)/f

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 43, normalized size of antiderivative = 0.96 \[ \int (3+b \sin (e+f x))^2 \, dx=\frac {1}{2} \, {\left (2 \, a^{2} + b^{2}\right )} x - \frac {2 \, a b \cos \left (f x + e\right )}{f} - \frac {b^{2} \sin \left (2 \, f x + 2 \, e\right )}{4 \, f} \]

[In]

integrate((a+b*sin(f*x+e))^2,x, algorithm="giac")

[Out]

1/2*(2*a^2 + b^2)*x - 2*a*b*cos(f*x + e)/f - 1/4*b^2*sin(2*f*x + 2*e)/f

Mupad [B] (verification not implemented)

Time = 7.85 (sec) , antiderivative size = 44, normalized size of antiderivative = 0.98 \[ \int (3+b \sin (e+f x))^2 \, dx=-\frac {\frac {b^2\,\sin \left (2\,e+2\,f\,x\right )}{2}+4\,a\,b\,\cos \left (e+f\,x\right )-2\,a^2\,f\,x-b^2\,f\,x}{2\,f} \]

[In]

int((a + b*sin(e + f*x))^2,x)

[Out]

-((b^2*sin(2*e + 2*f*x))/2 + 4*a*b*cos(e + f*x) - 2*a^2*f*x - b^2*f*x)/(2*f)